<!-- 此页面没做loaded处理（图片是否加载成功/失败），因为套层级太多，太复杂，如有需要，需要去cart页面（购物车页面）参考 -->
<template>
	<view class="container">
		<!-- <image class="news_img" src="../../static/fptc.jpg"></image> -->
		<view v-if="type == 1">
			<view class="news_title">
				{{announcementBox.notice_title}}
			</view>
			<view class="news_content" v-html="announcementBox.notice_content"></view>
		</view>
		<view v-if="type == 2">
			<view class="news_title">
				{{allBox.title}}
			</view>
			<view class="news_time">时间：{{allBox.update_at}}</view>
			<view class="news_content" v-html="allBox.content"></view>
		</view>
	</view>
</template>

<script>
	export default {

		data() {
			return {
				allBox:{},
				announcementBox:{},
				type:1
			};
		},
		onShow() {
			
		},
		onLoad(option) {
			this.type = option.num;
			if(option.num == 1){
				this.announcement()
			}else if(option.num == 2){
				this.getAllBox(option.id)
			}
		},
		//下拉刷新
		onPullDownRefresh() {
			
		},
		methods: {
			getAllBox(id) {
				let that = this;
				that.$Request.get(that.$api.company.apiArticle, {
						id: id
					}).then(res => {
					that.allBox = res.data;
					uni.setNavigationBarTitle({
					  title: that.allBox.title 
					})
					console.log('已发布推文详细内容',that.allBox)
				}, err => {
					console.log("err: " + JSON.stringify(err));
				});
			},
			announcement(id) {
				let that = this;
				that.$Request.get(that.$api.company.apiNotice, {}).then(res => {
					that.announcementBox = res.data;
					uni.setNavigationBarTitle({
					  title: that.announcementBox.notice_title
					})
					console.log('已发布公告详细内容',that.announcementBox)
				}, err => {
					console.log("err: " + JSON.stringify(err));
				});
			},
		}
	}
</script>

<style lang="scss">
	page {
		background: #f5f5f5;
	}
	.news_img{
		width: 100vw;
	}
	.news_title{
		padding:2vw;
		font-size: 36rpx;
		text-align: center;
	}
	.news_time{
		padding:2vw;
		font-size: 28rpx;
		color: #666;
		text-align: center;
	}
	.news_content{
		padding:2vw;
		font-size: 30rpx;
		line-height: 46rpx;
	}
	
	
	
	
	
	
	.welfare{
		background: #fff;
		padding: 2vw;
		.welfare_eve{
			border-bottom: 1rpx solid #eaeef1;
			.welfare_eve_top{
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 2vw 0;
				.welfare_eve_top_left{
					font-size: 32rpx;
					text{
						color: #B72B24;
						margin-left: 2vw;
					}
				}
				.welfare_eve_top_right{
					font-size: 28rpx;
					color: #666;
				}
			}
			.welfare_eve_bot{
				padding: 2vw 0;
				font-size: 32rpx;
			}
		}
	}
</style>
